
<html><head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta content="text/javascript" http-equiv="content-script-type">
<title>system.collections.PriorityQueue</title>
<link rel="stylesheet" type="text/css" href="candydoc/style.css">
<!--[if lt IE 7]><link rel="stylesheet" type="text/css" href="candydoc/ie56hack.css"><![endif]-->
<script language="JavaScript" src="candydoc/util.js" type="text/javascript"></script>
<script language="JavaScript" src="candydoc/tree.js" type="text/javascript"></script>
<script language="JavaScript" src="candydoc/explorer.js" type="text/javascript"></script>
</head><body>
<div id="tabarea"></div><div id="explorerclient"></div>
<div id="content"><script>explorer.initialize("system.collections.PriorityQueue");</script>
	<table class="content">
		<tr><td id="docbody"><h1>system.collections.PriorityQueue</h1><!-- Generated by Ddoc from F:\MyWork\phoenix\source\system\collections\PriorityQueue.d -->
该模块实现了一个优先级队列。
 更多信息请参考 http://www.cnblogs.com/lucifer1982/archive/2008/06/13/1218559.html
<br><br>
<b>License:</b><br>
BSD
<br><br>
<b>Authors:</b><br>
Lucifer (786325481@QQ.com)
<br><br>


<script>explorer.outline.incSymbolLevel();</script>
<dl>
<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl">class 
<span class="currsymbol">PriorityQueue</span>
<script>explorer.outline.addDecl('PriorityQueue');</script>

(T): IEnumerable!(T), ICollection!(T), IQueue!(T);
</span></dt>
<script>explorer.outline.writeEnabled = false;</script>


<dd>一个基于最小二叉堆的无界优先级队列。
<br><br>
<b>Comments:</b><br>
优先级队列不允许使用 <b>null</b> 元素。
 
<br><br>


<script>explorer.outline.incSymbolLevel();</script>
<dl>
<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl">this();
</span></dt>
<script>explorer.outline.writeEnabled = false;</script>


<dd>使用默认的初始容量（16）创建一个 PriorityQueue，并根据默认比较器对元素进行排序。
	 
<br><br>

</dd>

<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl">this(int initialCapacity);
</span></dt>
<script>explorer.outline.writeEnabled = false;</script>


<dd>使用指定的初始容量创建一个 PriorityQueue，并根据默认比较器对元素进行排序。
	 
<br><br>

</dd>

<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl">this(IComparer!(T) comparer);
</span></dt>
<script>explorer.outline.writeEnabled = false;</script>


<dd>使用默认的初始容量（16）创建一个 PriorityQueue，并根据指定的比较器对元素进行排序。
	 
<br><br>

</dd>

<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl">this(int initialCapacity, IComparer!(T) comparer);
</span></dt>
<script>explorer.outline.writeEnabled = false;</script>


<dd>使用指定的初始容量创建一个 PriorityQueue，并根据指定的比较器对元素进行排序。
<br><br>
<b>Params:</b><br>
<table><tr>
<td nowrap valign="top" style="padding-right: 8px">initialCapacity</td>

               
<td>指定优先级队列初始容量。</td></tr>
<tr>
<td nowrap valign="top" style="padding-right: 8px">comparer</td>

               
<td>制定比较器。</td></tr>
</table><br>

</dd>

<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl">this(IEnumerable!(T) collection);
</span></dt>
<script>explorer.outline.writeEnabled = false;</script>


<dd>复制指定的集合元素创建一个PriorityQueue，并根据默认比较器对元素进行排序。
	 
<br><br>

</dd>

<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl">class 
<span class="currsymbol">Enumerator</span>
<script>explorer.outline.addDecl('Enumerator');</script>

: IEnumerator!(T);
</span></dt>
<script>explorer.outline.writeEnabled = false;</script>


<dd><b>Throws:</b><br>
InvalidOperationException，当在遍历对象时修改了集合。
     
<br><br>

</dd>

<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl">bool 
<span class="currsymbol">isEmpty</span>
<script>explorer.outline.addDecl('isEmpty');</script>

();
</span></dt>
<script>explorer.outline.writeEnabled = false;</script>


<dd>查看优先级队列是否为空。
<br><br>
<b>Returns:</b><br>
如果为空，返回 <b>true</b>；否则，返回 <b>false</b>。
	 
<br><br>

</dd>

<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl">int 
<span class="currsymbol">count</span>
<script>explorer.outline.addDecl('count');</script>

();
</span></dt>
<script>explorer.outline.writeEnabled = false;</script>


<dd>返回优先级队列包含的元素数目。
	 
<br><br>

</dd>

<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl">bool 
<span class="currsymbol">isReadOnly</span>
<script>explorer.outline.addDecl('isReadOnly');</script>

();
</span></dt>
<script>explorer.outline.writeEnabled = false;</script>


<dd>查看优先级队列是否只读。
<br><br>
<b>Returns:</b><br>
<b>false</b>。
	 
<br><br>

</dd>

<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl">bool 
<span class="currsymbol">add</span>
<script>explorer.outline.addDecl('add');</script>

(T <span class="funcparam">item</span>);
</span></dt>
<script>explorer.outline.writeEnabled = false;</script>


<dd>将指定的元素插入此优先级队列。
<br><br>
<b>Params:</b><br>
<table><tr>
<td nowrap valign="top" style="padding-right: 8px">T <span class="funcparam">item</span></td>

               
<td>要添加的元素。</td></tr>
</table><br>
<b>Returns:</b><br>
<b>true</b>。
	 
<br><br>

</dd>

<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl">bool 
<span class="currsymbol">tryAdd</span>
<script>explorer.outline.addDecl('tryAdd');</script>

(T <span class="funcparam">item</span>);
</span></dt>
<script>explorer.outline.writeEnabled = false;</script>


<dd>ditto。
<br><br>

</dd>

<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl">void 
<span class="currsymbol">clear</span>
<script>explorer.outline.addDecl('clear');</script>

();
</span></dt>
<script>explorer.outline.writeEnabled = false;</script>


<dd>从此优先级队列中移除所有元素。此调用返回后队列为空。
<br><br>

</dd>

<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl">bool 
<span class="currsymbol">remove</span>
<script>explorer.outline.addDecl('remove');</script>

(T <span class="funcparam">item</span>);
</span></dt>
<script>explorer.outline.writeEnabled = false;</script>


<dd>从此队列中移除指定元素的单个实例（如果存在）。
<br><br>
<b>Params:</b><br>
<table><tr>
<td nowrap valign="top" style="padding-right: 8px">T <span class="funcparam">item</span></td>

               
<td>要从此队列中移除的元素（如果存在）。</td></tr>
</table><br>
<b>Returns:</b><br>
如果此队列由于调用而发生更改，则返回 <b>true</b>。
	 
<br><br>

</dd>

<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl">bool 
<span class="currsymbol">contains</span>
<script>explorer.outline.addDecl('contains');</script>

(T <span class="funcparam">item</span>);
</span></dt>
<script>explorer.outline.writeEnabled = false;</script>


<dd>如果此队列包含指定的元素，则返回 <b>true</b>。
<br><br>
<b>Params:</b><br>
<table></table><br>

</dd>

<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl">void 
<span class="currsymbol">toArray</span>
<script>explorer.outline.addDecl('toArray');</script>

(T[] <span class="funcparam">array</span>);
</span></dt>
<script>explorer.outline.writeEnabled = false;</script>


<dd>将优先级队列中的内容拷贝到指定的数组中。
	 
<br><br>

</dd>

<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl">bool 
<span class="currsymbol">enqueue</span>
<script>explorer.outline.addDecl('enqueue');</script>

(T <span class="funcparam">item</span>);
</span></dt>
<script>explorer.outline.writeEnabled = false;</script>


<dd>将指定的元素插入此优先级队列。
<br><br>

</dd>

<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl">T 
<span class="currsymbol">dequeue</span>
<script>explorer.outline.addDecl('dequeue');</script>

();
</span></dt>
<script>explorer.outline.writeEnabled = false;</script>


<dd>获取并移除此队列的头。
<br><br>
<b>Throws:</b><br>
InvalidOperationException，当队列为空时。
<br><br>
<b>Comments:</b><br>
等效于 remove() 方法。
	 
<br><br>

</dd>

<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl">T 
<span class="currsymbol">remove</span>
<script>explorer.outline.addDecl('remove');</script>

();
</span></dt>
<script>explorer.outline.writeEnabled = false;</script>


<dd>获取并移除此队列的头。
<br><br>
<b>Throws:</b><br>
InvalidOperationException，当队列为空时。
	 
<br><br>

</dd>

<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl">T 
<span class="currsymbol">peek</span>
<script>explorer.outline.addDecl('peek');</script>

();
</span></dt>
<script>explorer.outline.writeEnabled = false;</script>


<dd>获取但不移除此队列的头。
<br><br>
<b>Throws:</b><br>
InvalidOperationException，当队列为空时。
	 
<br><br>

</dd>

<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl">bool 
<span class="currsymbol">tryEnqueue</span>
<script>explorer.outline.addDecl('tryEnqueue');</script>

(T <span class="funcparam">item</span>);
</span></dt>
<script>explorer.outline.writeEnabled = false;</script>


<dd>等效于 tryAdd(T <span class="funcparam">item</span>) 方法。
<br><br>

</dd>

<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl">bool 
<span class="currsymbol">tryPeek</span>
<script>explorer.outline.addDecl('tryPeek');</script>

(out T <span class="funcparam">item</span>);
</span></dt>
<script>explorer.outline.writeEnabled = false;</script>


<dd>等效于 peek() 方法，唯一不同的是该方法不抛异常。
<br><br>
<b>Params:</b><br>
<table><tr>
<td nowrap valign="top" style="padding-right: 8px">T <span class="funcparam">item</span></td>

               
<td>此队列的头。</td></tr>
</table><br>
<b>Returns:</b><br>
如果队列为空，返回 <b>false</b>；否则返回 <b>true</b>。
	 
<br><br>

</dd>
</dl>
<script>explorer.outline.decSymbolLevel();</script>


</dd>
</dl>
<script>explorer.outline.decSymbolLevel();</script>


</td></tr>
		<tr><td id="docfooter">
			Page was generated with
			<img src="candydoc/img/candydoc.gif" style="vertical-align:middle; position:relative; top:-1px">
			on Sat Nov 29 22:33:12 2008

		</td></tr>
	</table>
</div>
<script>
	explorer.packageExplorer.addModule("platform.PAL");
	explorer.packageExplorer.addModule("platform.windows.Core");
	explorer.packageExplorer.addModule("platform.linux.Core");
	explorer.packageExplorer.addModule("system.Array");
	explorer.packageExplorer.addModule("system.BitArray");
	explorer.packageExplorer.addModule("system.Environment");
	explorer.packageExplorer.addModule("system.Event");
	explorer.packageExplorer.addModule("system.Exception");
	explorer.packageExplorer.addModule("system.Hash");
	explorer.packageExplorer.addModule("system.IntPtr");
	explorer.packageExplorer.addModule("system.Random");
	explorer.packageExplorer.addModule("system.Traits");
	explorer.packageExplorer.addModule("system.TypeTuple");
	explorer.packageExplorer.addModule("system.math.IEEE");
	explorer.packageExplorer.addModule("system.math.Math");
	explorer.packageExplorer.addModule("system.runtime.c.complex");
	explorer.packageExplorer.addModule("system.runtime.c.config");
	explorer.packageExplorer.addModule("system.runtime.c.ctype");
	explorer.packageExplorer.addModule("system.runtime.c.errno");
	explorer.packageExplorer.addModule("system.runtime.c.fenv");
	explorer.packageExplorer.addModule("system.runtime.c.inttypes");
	explorer.packageExplorer.addModule("system.runtime.c.limits");
	explorer.packageExplorer.addModule("system.runtime.c.locale");
	explorer.packageExplorer.addModule("system.runtime.c.math");
	explorer.packageExplorer.addModule("system.runtime.c.signal");
	explorer.packageExplorer.addModule("system.runtime.c.stdarg");
	explorer.packageExplorer.addModule("system.runtime.c.stddef");
	explorer.packageExplorer.addModule("system.runtime.c.stdint");
	explorer.packageExplorer.addModule("system.runtime.c.stdio");
	explorer.packageExplorer.addModule("system.runtime.c.stdlib");
	explorer.packageExplorer.addModule("system.runtime.c.string");
	explorer.packageExplorer.addModule("system.runtime.c.time");
	explorer.packageExplorer.addModule("system.runtime.c.wctype");
	explorer.packageExplorer.addModule("system.text.UTF");
	explorer.packageExplorer.addModule("system.threading.Atomic");
	explorer.packageExplorer.addModule("system.threading.ThreadUtility");
	explorer.packageExplorer.addModule("system.threading.synchronization.SpinWait");
	explorer.packageExplorer.addModule("system.collections.ArrayList");
	explorer.packageExplorer.addModule("system.collections.Comparer");
	explorer.packageExplorer.addModule("system.collections.Deque");
	explorer.packageExplorer.addModule("system.collections.EqualityComparer");
	explorer.packageExplorer.addModule("system.collections.Exception");
	explorer.packageExplorer.addModule("system.collections.HashMap");
	explorer.packageExplorer.addModule("system.collections.HashSet");
	explorer.packageExplorer.addModule("system.collections.ICollection");
	explorer.packageExplorer.addModule("system.collections.IComparer");
	explorer.packageExplorer.addModule("system.collections.IDeque");
	explorer.packageExplorer.addModule("system.collections.IEnumerable");
	explorer.packageExplorer.addModule("system.collections.IEnumerator");
	explorer.packageExplorer.addModule("system.collections.IEqualityComparer");
	explorer.packageExplorer.addModule("system.collections.IList");
	explorer.packageExplorer.addModule("system.collections.IMap");
	explorer.packageExplorer.addModule("system.collections.IQueue");
	explorer.packageExplorer.addModule("system.collections.LinkedList");
	explorer.packageExplorer.addModule("system.collections.Pair");
	explorer.packageExplorer.addModule("system.collections.PrimeHelper");
	explorer.packageExplorer.addModule("system.collections.PriorityQueue");
	explorer.packageExplorer.addModule("system.collections.Queue");
	explorer.packageExplorer.addModule("system.collections.RBTree");
	explorer.packageExplorer.addModule("system.collections.Stack");
	explorer.packageExplorer.addModule("system.collections.TreeMap");
	explorer.packageExplorer.addModule("system.collections.TreeSet");
	explorer.packageExplorer.addModule("system.collections.objectmodel.ListCollection");
	explorer.packageExplorer.addModule("system.collections.objectmodel.ReadOnlyListCollection");</script>
</body></html>


